Skip to content
This repository has been archived by the owner on Oct 2, 2024. It is now read-only.

Add support for dotenv. #19

Closed
wants to merge 1 commit into from
Closed

Conversation

sefininio
Copy link

What is this?

This will allow us to auto-load environment variables configured in .env files,
instead of having to load them manually.

Does this change affect other projects?

This will not require any code changes on gateways, however it will require the .env files to have a slightly different format, namely: instead of export VAR_NAME=value, dotenv expects VAR_NAME=value, so this has implications on all gateway code that uses .env files.
That said, this will not break if the .env file remains unchanged and we can still use the manual source .env option until all gateways are updated.

Naming conventions

I am not sure the variables / file names I used comply with the conventions we normally use for nodule* projects, so I'd welcome any alternatives you might suggest.

This will allow us to auto-load environment variables configured in .env files,
instead of having to load them manbually.
@sefininio
Copy link
Author

For some reason, CircleCI fails on unauthorized when trying to install dotenv. Maybe @KensoDev can help?

@@ -0,0 +1,3 @@
import dotenv from 'dotenv';

export default dotenv.config({ silent: true });
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should run before all other code that might use process.env, hence it is important to export it in the index.js file before all other exports.

For more info, please see here: https://www.npmjs.com/package/dotenv#how-do-i-use-dotenv-with-import- and here: motdotla/dotenv#133 (comment)

@KensoDev
Copy link
Contributor

KensoDev commented Aug 3, 2018

Commented on the issue in Slack DM.

@KensoDev
Copy link
Contributor

KensoDev commented Aug 3, 2018

Please make sure to namespace jfrog, this package should come from npm, not from jfrog.

Copy link
Contributor

@KensoDev KensoDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure you reinstall the package using only npm repos without mentioning jfrog.

This will allow it to work.

@sefininio sefininio closed this Aug 3, 2018
@KensoDev KensoDev deleted the feature/add-dotenv-support branch August 3, 2018 12:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants